take frame offest into account when trying to calculate the animation
authorLarry Ewing <lewing@helixcode.com>
Tue, 6 Jun 2000 20:37:28 +0000 (20:37 +0000)
committerLarry Ewing <lewing@src.gnome.org>
Tue, 6 Jun 2000 20:37:28 +0000 (20:37 +0000)
2000-06-06  Larry Ewing  <lewing@helixcode.com>

* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
take frame offest into account when trying to calculate the
animation bbox.  Also set the width to the width not the height.
(gdk_pixbuf_loader_frame_done): cycle over the frames to calculate
bbox since only now do we have all the offset information for each
frame.

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-loader.c
gtk/gdk-pixbuf-loader.c

index 6bc577465eede1cc41465ad9765cf666ce464281..48b4bea08ac0d6eb26171b90e0e1d8783665b26e 100644 (file)
@@ -1,3 +1,12 @@
+2000-06-06  Larry Ewing  <lewing@helixcode.com>
+
+       * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
+       take frame offest into account when trying to calculate the
+       animation bbox.  Also set the width to the width not the height.
+       (gdk_pixbuf_loader_frame_done): cycle over the frames to calculate
+       bbox since only now do we have all the offset information for each
+       frame.
+
 2000-06-05     Mathieu Lacage  <mathieu@gnome.org>
 
        * configure.in: add some gtk parameters to the
index 5165c71badf1432e7699a5cb9766561b7a4f7cf3..63b9f1c598cecff72845f1bace351f3829fb7994 100644 (file)
@@ -271,17 +271,17 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
                priv->animation = g_new0 (GdkPixbufAnimation, 1);
                priv->animation->n_frames = 0;
                priv->animation->ref_count = 1;
-               priv->animation->width  = gdk_pixbuf_get_width  (frame->pixbuf);
-               priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf);
+               priv->animation->width  = gdk_pixbuf_get_width  (frame->pixbuf) + frame->x_offset;
+               priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
        } else {
                int w, h;
 
                /* update bbox size */
-               w = gdk_pixbuf_get_width (frame->pixbuf);
-               h = gdk_pixbuf_get_height (frame->pixbuf);
+               w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset;
+               h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
 
                if (w > priv->animation->width) {
-                       priv->animation->width = h;
+                       priv->animation->width = w;
                }
                if (h > priv->animation->height) {
                        priv->animation->height = h;
@@ -298,6 +298,32 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
 static void
 gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader)
 {
+       GdkPixbufLoaderPrivate *priv = NULL;
+       GdkPixbufFrame    *frame;
+       GList *current = NULL;
+       gint h, w;
+
+       priv = GDK_PIXBUF_LOADER (loader)->private;
+       priv->pixbuf = NULL;
+
+       current = gdk_pixbuf_animation_get_frames (priv->animation);
+
+       while (current) {
+               frame = (GdkPixbufFrame *) current->data;
+
+               /* update bbox size */
+               w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset;
+               h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
+
+               if (w > priv->animation->width) {
+                       priv->animation->width = w;
+               }
+               if (h > priv->animation->height) {
+                       priv->animation->height = h;
+               }
+               current = current->next;
+       }
+
        gtk_signal_emit (GTK_OBJECT (loader),
                         pixbuf_loader_signals[ANIMATION_DONE]);
 }
index 5165c71badf1432e7699a5cb9766561b7a4f7cf3..63b9f1c598cecff72845f1bace351f3829fb7994 100644 (file)
@@ -271,17 +271,17 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
                priv->animation = g_new0 (GdkPixbufAnimation, 1);
                priv->animation->n_frames = 0;
                priv->animation->ref_count = 1;
-               priv->animation->width  = gdk_pixbuf_get_width  (frame->pixbuf);
-               priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf);
+               priv->animation->width  = gdk_pixbuf_get_width  (frame->pixbuf) + frame->x_offset;
+               priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
        } else {
                int w, h;
 
                /* update bbox size */
-               w = gdk_pixbuf_get_width (frame->pixbuf);
-               h = gdk_pixbuf_get_height (frame->pixbuf);
+               w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset;
+               h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
 
                if (w > priv->animation->width) {
-                       priv->animation->width = h;
+                       priv->animation->width = w;
                }
                if (h > priv->animation->height) {
                        priv->animation->height = h;
@@ -298,6 +298,32 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
 static void
 gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader)
 {
+       GdkPixbufLoaderPrivate *priv = NULL;
+       GdkPixbufFrame    *frame;
+       GList *current = NULL;
+       gint h, w;
+
+       priv = GDK_PIXBUF_LOADER (loader)->private;
+       priv->pixbuf = NULL;
+
+       current = gdk_pixbuf_animation_get_frames (priv->animation);
+
+       while (current) {
+               frame = (GdkPixbufFrame *) current->data;
+
+               /* update bbox size */
+               w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset;
+               h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset;
+
+               if (w > priv->animation->width) {
+                       priv->animation->width = w;
+               }
+               if (h > priv->animation->height) {
+                       priv->animation->height = h;
+               }
+               current = current->next;
+       }
+
        gtk_signal_emit (GTK_OBJECT (loader),
                         pixbuf_loader_signals[ANIMATION_DONE]);
 }